package cn.ld.module.infra.dal.mapper.demo.demo03;

import cn.ld.framework.common.pojo.PageParam;
import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.module.infra.dal.entity.demo.demo03.Demo03CourseEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 学生课程 Mapper
 *
 * @author 蓝盾
 */
@Mapper
public interface Demo03CourseMapper extends BaseMapperX<Demo03CourseEntity> {

    default PageResult<Demo03CourseEntity> selectPage(PageParam inVO, Long studentId) {
        return selectPage(inVO, new LambdaQueryWrapperX<Demo03CourseEntity>()
                .eq(Demo03CourseEntity::getStudentId, studentId)
                .orderByDesc(Demo03CourseEntity::getId));
    }

    default List<Demo03CourseEntity> selectListByStudentId(Long studentId) {
        return selectList(Demo03CourseEntity::getStudentId, studentId);
    }

    default int deleteByStudentId(Long studentId) {
        return delete(Demo03CourseEntity::getStudentId, studentId);
    }

}